home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / pascal / dateit3a.zip / DATEIT.DOC < prev    next >
Text File  |  1988-07-19  |  9KB  |  276 lines

  1.  
  2.                DateIt v.3a       Copyright July 1988 by WardWares
  3.  
  4.  
  5.     PURPOSE:
  6.       
  7.       Place all Date Manipulation Operations in one UNIT Library
  8.       for easier access.
  9.  
  10.     IMPROVEMENTS:
  11.  
  12.       Added the windowing units so that others could compile the
  13.       DateDemo program.
  14.  
  15.  
  16.     FILES:
  17.  
  18.       In this version of DateIt you will find, unless infected:
  19.  
  20.         DATEIT.DOC   - This Documentation file.
  21.         WWDATEIT.TPU - The DateIt Unit.
  22.         DATEDEMO.PAS - Source Code for the Demo.
  23.         DATEIT.FRM   - Registration Form.
  24.         QWIK.TPU     {                  }
  25.         WNDW.TPU     { Windowing Units. }
  26.         WNDWVARS.TPU {                  }
  27.  
  28.     CREDITS:
  29.      
  30.       COPYRIGHT 1988 By WardWares
  31.  
  32.       If there are any problems or suggestions, I would like to hear
  33.       from you.  I can be reached during the days at (513) 896-5007
  34.       or by FIDO NetMail at 108/10, ask for or send mail in care of
  35.       Jim Ward.  I will reply to all who are serious about working
  36.       with or improving DateIt.
  37.  
  38.     SHAREWARE:
  39.  
  40.       For those first 10 people who are willing to pay $10 you will
  41.       receive a copy of the source code on disk.  After that the 
  42.       source will be sold for $25.  All who register will be entitled
  43.       to receive updates as they come and they will, for as soon as
  44.       a package is produced someone says, "I wish it would do...."
  45.  
  46.       Send you checks to:
  47.                            WardWares
  48.                            1130 NW Washington, Suite 4
  49.                            Hamilton, OH 45013
  50.  
  51.     DOCUMENTATION:
  52.  
  53.       This is in no way GREAT documentation, but it is better than what
  54.       was presented in past additions, NOTHING.  If you have any excellent
  55.       suggestions or problems please send them to the above address.
  56.       I would like to make this documentation clear to all.
  57.  
  58.  
  59.  
  60.  
  61.                DateIt v.3a       Copyright July 1988 by WardWares
  62.  
  63.     COMMANDS USED IN DateIt:
  64.  
  65.       The Date is set up as a RECORD of:
  66.  
  67.         dRec = RECORD
  68.                 m,d,y,w: WORD
  69.                END;
  70.  
  71.       This represents m - Month, d - Day, y - Year, w - Day of Week.
  72.       To use with the a Turbo Pascal v4.0 command such as GETDATE
  73.       do the following.
  74.  
  75.         VAR           {Your Program should set up a variable}
  76.           Date: dRec; {of this type so you can pass date information}
  77.         BEGIN         {to DateIt's Functions.}
  78.           ...
  79.           GETDATE(Date.y,Date.m,Date.d,Date.w); 
  80.           ...
  81.         END.
  82.  
  83.       All of DateIt's functions use this type of packed date, let's
  84.       take a look at our first function.
  85.  
  86.  
  87.  
  88.     FUNCTION: Julian(z: dRec): INTEGER;
  89.  
  90.         USAGE: VAR
  91.                  Date: dRec;
  92.                  v: INTEGER;
  93.                BEGIN
  94.                 GETDATE(Date.y,Date.m,Date.d,Date.w); 
  95.                  v := Julian(Date); {Returns a number from 1-366
  96.                                      according to date given}
  97.                END.
  98.  
  99.  
  100.     
  101.  
  102.     FUNCTION: LeapYear(y: WORD): INTEGER;
  103.  
  104.         USAGE: VAR
  105.                  Date: dRec;
  106.                  v: INTEGER;
  107.                BEGIN
  108.                 GETDATE(Date.y,Date.m,Date.d,Date.w); 
  109.                  v := LeapYear(Date.y); {Returns a 1 if the Year is
  110.                                          an actual Leap Year or a 0
  111.                                          if it is NOT.}
  112.                  IF (v=1) THEN
  113.                    WRITELN('This is a Leap Year.')
  114.                  ELSE
  115.                    WRITELN('This is NOT a Leap Year.');
  116.                END.
  117.  
  118.  
  119.  
  120.  
  121.                DateIt v.3a       Copyright July 1988 by WardWares
  122.  
  123.     FUNCTION: CkDate(z: dRec): BOOLEAN;
  124.  
  125.         USAGE: VAR
  126.                  Date: dRec;
  127.                BEGIN
  128.                 GETDATE(Date.y,Date.m,Date.d,Date.w); 
  129.                  IF (CkDate(Date)) THEN           {Returns TRUE if the
  130.                    WRITELN('This Date is Valid.')  Date Given is Valid
  131.                  ELSE                              and FALSE if it is not}
  132.                    WRITELN('This Date is Invalid.');
  133.                END.
  134.  
  135.  
  136.  
  137.  
  138.  
  139.     FUNCTION: MonStr(m: WORD;Style: mType): STRING;
  140.  
  141.         USAGE: VAR
  142.                  Date: dRec;
  143.                  aSt: STRING;
  144.                BEGIN
  145.                 GETDATE(Date.y,Date.m,Date.d,Date.w);
  146.                 aSt := MonStr(Date.m,Mon); {This passes the month in
  147.                                             a 3 character format}
  148.                 aSt := MonStr(Date.m,Month); {This passes the month
  149.                                               as a full string}
  150.                END.
  151.  
  152.  
  153.  
  154.  
  155.     FUNCTION: DayStr(w: WORD;Style: wTy): STRING;
  156.  
  157.         USAGE: VAR
  158.                  Date: dRec;
  159.                  aSt: STRING;
  160.                BEGIN
  161.                  GETDATE(Date.y,Date.m,Date.d,Date.w);
  162.                  aSt := DayStr(Date.d,Short); {This passes the weekday
  163.                                                name in a 3 character format}
  164.                  aSt := DayStr(Date.d,Long); {This passes the weekday
  165.                                               as a full string}
  166.                END.
  167.              
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.                DateIt v.3a       Copyright July 1988 by WardWares
  182.  
  183.     FUNCTION: DateStr(z: dRec;Style: wTy;Dvd: sTy): STRING;
  184.  
  185.         USAGE: VAR
  186.                  Date: dRec;
  187.                  aSt: STRING;
  188.                BEGIN
  189.                  GETDATE(Date.y,Date.m,Date.d,Date.w);
  190.                  aSt := DayStr(Date,MDY4,Slash); {This a Date String with
  191.                                                   slashes, you can also use
  192.                                                   the either: Dash or Period
  193.                                                   in place of Slash
  194.                                                   (see DateDemo for all of
  195.                                                   the possible date formats)}
  196.                END.
  197.  
  198.  
  199.  
  200.  
  201.     PROCEDURE: ComputeDays(z: dRec;n: INTEGER;VAR x: dRec;Style: aTy);
  202.  
  203.         USAGE: VAR
  204.                  Date,Date2: dRec;
  205.                BEGIN
  206.                  GETDATE(Date.y,Date.m,Date.d,Date.w);
  207.                  ComputeDays(Date,100,Date2,Add); {This adds 100 days to
  208.                                                    Date and puts the answer
  209.                                                    in Date2}
  210.                  ComputeDays(Date,200,Date2,Sub); {This subtracts 200 from
  211.                                                    Date and puts the answer
  212.                                                    in Date2}
  213.                END.
  214.  
  215.     
  216.  
  217.     PROCEDURE: Tomorrow(z: dRec;VAR x: dRec);
  218.  
  219.         USAGE: VAR
  220.                  Date,Date2: dRec;
  221.                BEGIN
  222.                  GETDATE(Date.y,Date.m,Date.d,Date.w);
  223.                  Tomorrow(Date,Date2); {Returns the date after the
  224.                                         given Date an puts the result
  225.                                         in Date2}
  226.                END.
  227.  
  228.  
  229.  
  230.     PROCEDURE: Yesterday(z: dRec;VAR x: dRec);
  231.  
  232.         USAGE: VAR
  233.                  Date,Date2: dRec;
  234.                BEGIN
  235.                  GETDATE(Date.y,Date.m,Date.d,Date.w);
  236.                  Yesterday(Date,Date2); {Returns the date before the
  237.                                          given Date an puts the result
  238.                                          in Date2}
  239.                END.
  240.  
  241.                DateIt v.3a       Copyright July 1988 by WardWares
  242.  
  243.  
  244.     FUNCTION: DiffDates(z,x: dRec;Style: nType): INTEGER;
  245.  
  246.         USAGE: VAR
  247.                  Date,Date2: dRec;
  248.                  v: INTEGER;
  249.                BEGIN
  250.                  GETDATE(Date.y,Date.m,Date.d,Date.w);
  251.                  Date2.y := 1988; Date2.m := 7; Date2.d := 18; Date2.w := 1;
  252.                  v := DiffDates(Date,Date2,Days); {Returns the number of days
  253.                                                    between Date and Date2}
  254.                  v := DiffDates(Date,Date2,Months); {Returns the number of
  255.                                                      months between Date
  256.